﻿// Sheego.Service.X400
// Copyright(C) 2015 Schwab Versand GmbH
//
// This source file is subject to the Microsoft Public License(Ms-PL).
// http://www.opensource.org/licenses/ms-pl.html
// All other rights reserved.
using Sheego.Service.X400.Job.Shared.BO;
using Sheego.Service.X400.Job.Shared.Matcher;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sheego.Service.X400.Job.Impl.Matcher
{
    class StaticMatcher : IX400MessageMatcher
    {
        private bool MatchValue = false;
        #region IX400MessageMatcher Members

        public bool Match(IX400Message Message)
        {
            if (Message == null)
                throw new ArgumentNullException("Message");

            return MatchValue;
        }

        public void Config(string Key, string Value)
        {
            if (string.IsNullOrWhiteSpace(Key))
                throw new ArgumentNullException("Key");
            if (string.IsNullOrWhiteSpace(Value))
                throw new ArgumentNullException("Value");

            if (Key.Equals("Match"))
            {
                MatchValue = Boolean.Parse(Value);
                return;
            }

            throw new KeyNotFoundException(Key);
        }

        #endregion
    }
}
